<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/view/system/common/head.jsp"%>
<script type="text/javascript">
	$(function(){
	    resetForm();
		$(".pwdInput").focus(function(event) {
		   $(this).attr('type','password');
		});
	   
	});
	
	//修改密码保存成功
  	function changePswOk(){
         var valid = $('#pwdForm').form('validate');
         if (valid) {
        		var param = new Object();
        		param.oldPwd = $.trim($("#oldPwd").val());
        		param.oldPwdAgin = $.trim($("#oldPwdAgin").val());
        		param.newPwd = $.trim($("#newPwd").val());

        		if(param.oldPwdAgin != param.newPwd){
        			$.messager.alert("提示信息", "两次输入的密码不一致", 'error');
        			return;
        		}
        		$.axs("user/doUserPasswordChange.action", param, 
                  function(data){
        			if(data.status == 1){
        				$.messager.alert("提示信息", data.msg, 'info',
        						function(){
        					parent.$('#userInfo').window('close'); 
        				});
        			}else{
        				$.messager.alert("提示信息", data.msg, 'error');
        			}
        		});
         }
 	} 
	
  
  	function resetForm(){
  		/* $("#oldPwd").val("");
  		$("#oldPwdAgin").val("");
  		$("#newPwd").val(""); */
  		$('#pwdForm').form('reset');
  	}
  	
  	function closeWindow(){
       parent.$('#userInfo').window('close'); 
  	}
</script>

		<form id="pwdForm" >
			<table  class="MyTable1" style="border: 0px; text-align:center;" >
				<tr>
					<td>旧密码:</td>
					<td class="alineLeft">
						<input  id="oldPwd" name="oldPwd"
							class="easyui-validatebox myinput inputWidth pwdInput"
							required="true" missingMessage="请输入旧密码" placeholder="请输入旧密码"/>
						<input type="hidden" id="userInfoId" name="userInfoId"
							value="${txtUserId}" />
					</td>
				</tr>
				<tr>
					<td>新密码:</td>
					<td class="alineLeft">
						<input  id="oldPwdAgin" name="oldPwdAgin"
							class="easyui-validatebox myinput inputWidth pwdInput"
							required="true" missingMessage="请输入新密码" placeholder="请输入新密码"/>
					</td>
				</tr>
				<tr>
					<td>确认输入:</td>
					<td class="alineLeft">
						<input  id="newPwd" name="newPwd"
							class="easyui-validatebox myinput inputWidth pwdInput" 
							required="true" missingMessage="请再次输入新密码" placeholder="请输入确认密码"/>
						<span></span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<a class="easyui-linkbutton" iconCls="icon-ok"
							href="javascript:void(0)" onclick="changePswOk()">提交</a>
						<a class="easyui-linkbutton" iconCls="icon-undo"
							href="javascript:void(0)" onclick="resetForm()">重置</a>
					</td>
				</tr>
			</table>
		</form>